<?php
class User_model extends CI_Model{

	function __construct(){
	
		parent::__construct();
		
	
	}
	function getUser($query=FALSE,$id=FALSE,$limit=FALSE,$offset=FALSE){
		if ($query == 'list'){
			$this->db->order_by('id_admin','desc');
			return $this->db->get('tb_admin')->result_array();
		
		}
		
		elseif($query == 'by_id'){
			$this->db->where('id_admin',$id);
			return $this->db->get('tb_admin')->row();
		
		
		}





	}



	function addUser($data){
	
		$this->db->insert('tb_admin',$data);
	
	}

	function editUser($id,$data){
	
		$this->db->where('id_admin',$id);
		$this->db->update('tb_admin',$data);
	
	}

	function deleteUser($id){
	
		$this->db->where('id_admin',$id);
		$this->db->delete('tb_admin');
	
	}
}

?>